package copyengine.utils.tick.node
{
	import copyengine.utils.GeneralUtils;

	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;

	public final class AnimationMovieClipTickObject extends AnimationTickObjectNodeBasic
	{
		public function AnimationMovieClipTickObject(_target:DisplayObjectContainer, _callBackFunction:Function, _repeatTime:int, _endAction:int, _mcTotalFrame:int)
		{
			super(_target, _callBackFunction, _repeatTime, _endAction, _mcTotalFrame);
		}

		override protected function doTickTarget(_currentPlayFrame:int):Boolean
		{
//			movieClipeTarget.gotoAndStop(_currentPlayFrame)
			return _currentPlayFrame >= totalPlayFrame;
		}

		override protected function getTargetTotalFrame():int
		{
			return movieClipeTarget.totalFrames;
		}

		override protected function doDispose():void
		{
			switch (endAction)
			{
				case END_ACTION_DO_NOTHING:
					break;
				case END_ACTION_REMOVE:
					GeneralUtils.removeTargetFromParent(target);
					break;
				case END_ACTION_STOP:
					movieClipeTarget.stop();
					break;
				case END_ACTION_INVISIBLE:
					movieClipeTarget.stop();
					target.visible = false;
					break;
			}
		}

		private function get movieClipeTarget():MovieClip
		{
			return target as MovieClip;
		}

	}
}
